﻿CREATE TABLE [dbo].[Statistics_Performance] (
    [Id]             INT             IDENTITY (1, 1) NOT NULL,
    [StatisticsDate] DATE            NULL,
    [CompanyId]      INT             NULL,
    [CompanyName]    NVARCHAR (50)   NULL,
    [CategoryCode]   NVARCHAR (100)  NULL,
    [CategoryName]   NVARCHAR (200)  NULL,
    [TotalQuantity]  INT             DEFAULT ((0)) NULL,
    [TotalAmount]    DECIMAL (18, 2) DEFAULT ((0)) NULL,
    CONSTRAINT [PK_STATISTICS_PERFORMANCE] PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO
CREATE NONCLUSTERED INDEX [Index_CId_Code_Date]
    ON [dbo].[Statistics_Performance]([StatisticsDate] ASC, [CompanyId] ASC, [CategoryCode] ASC);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '业绩', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '统计日期', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'StatisticsDate';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '公司Id', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'CompanyId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '公司名称', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'CompanyName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '类别代码', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'CategoryCode';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '类别名称', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'CategoryName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '总数量', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'TotalQuantity';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = '总金额', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Statistics_Performance', @level2type = N'COLUMN', @level2name = N'TotalAmount';

